package com.sskj.candy.http;

import com.sskj.candy.bean.BalanceCqtfBean;
import com.sskj.candy.bean.CandyBean;
import com.sskj.candy.bean.CandyRecordBean;
import com.sskj.candy.bean.CandyRecordBean;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.request.PostRequest;
import com.sskj.candy.bean.CandyRankBean;
import com.sskj.candy.bean.CandyTextBean;
import com.sskj.common.base.HttpData;
import com.sskj.lib.bean.PageBean;

/**
 * 作者 :吕志豪
 * 简书：https://www.jianshu.com/u/6e525b929aac
 * github：https://github.com/lvzhihao100
 * 描述：
 * 创建时间：2018-10-15 14:08
 */
public class HttpService {


    /**
     * 领取红利
     *
     * @param id 红利记录id
     * @return
     */
    public PostRequest<HttpData> getSuger(String id) {
        return OkGo.<HttpData>post(HttpConfig.BASE_URL + HttpConfig.GET_SUGER)
                .params("id", id);
    }

    /**
     * 排行榜
     *
     * @param p    页码，默认1
     * @param size 每页多少条，默认15
     * @return
     */
    public PostRequest<HttpData<CandyBean>> getSugerRank(int p, int size) {
        return OkGo.<HttpData<CandyBean>>post(HttpConfig.BASE_URL + HttpConfig.GET_SUGER_RANK)
                .params("p", p)
                .params("size", size);
    }

    /**
     * 红利记录
     *
     * @param status 1未领取 2已领取，默认全部
     * @return
     */
    public PostRequest<HttpData<PageBean<CandyRecordBean>>> getSugerRecord(int status) {
        return OkGo.<HttpData<PageBean<CandyRecordBean>>>post(HttpConfig.BASE_URL + HttpConfig.GET_SUGER_RECORD)
                .params("status", status);
    }

    // 红利轮播
    public PostRequest<HttpData<CandyTextBean>> getCandyBanner() {
        return OkGo.<HttpData<CandyTextBean>>post(HttpConfig.BASE_URL + HttpConfig.CANDY_BANNER);
    }
    public PostRequest<HttpData<BalanceCqtfBean>> getBalance() {
        return OkGo.<HttpData<BalanceCqtfBean>>post(HttpConfig.BASE_URL + HttpConfig.GET_BALANCE);

    }

}